<div class="container">
    <h4>Bài viết</h4>
</div>
<div class="container" style="margin-bottom: -1px;" >
    <div style="margin-top: 10px" >
        <ul class="nav nav-tabs nav-collapse">
            <li class="active">
                <a href="<?= $this->baseUrl ?>cp/idata.html">Bài viết</a>
            </li>
        </ul>
    </div>      
</div> 
<div class="container" style="border: 1px solid #ccc; padding-top: 10px;" >
    <div class="form-group ">
        <button type="button" onclick="catelog.add();" class="btn btn-info">
            <i class="glyphicon glyphicon-plus"></i> Thêm bài viết
        </button>
    </div>
    <p class="clearfix" ></p>
    <div style="margin-top: 10px;">
        <h5 class="pull-left alert alert-success" style="padding: 10px; width: 33%;" >
            Tìm thấy tổng số 
            <span style="color: tomato; font-weight: bolder"><?= $dataPage->dataCount ?></span> 
            bài viết trong 
            <span style="color: tomato; font-weight: bolder"><?= $dataPage->pageCount ?></span> trang.
        </h5>
        <div class="btn-toolbar pull-right" style="padding: 15px 0px;">
            <?= $this->loadView('/widget/page'); ?>
        </div>
    </div>
    <p class="clearfix" ></p>
    <table  class="table table-striped table-bordered table-responsive" style="margin-bottom: 10px;" >
        <thead>
            <tr class="success" >
                <th class="text-center">Hình ảnh</th>
                <th class="text-center">Mã</th>
                <th class="text-center">Tên bài viết</th>                             
                <th class="text-center">Danh mục cha</th>                             
                <th class="text-center">
                    Trạng thái
                    <i class="glyphicon glyphicon-edit pull-right"></i>
                </th>   
                <th class="text-center">Chức năng</th>                             
            </tr>
        </thead>
        <tbody>
            <?php foreach ($dataPage->data as $item) { ?>
                <?php
                $arrItem[] = $item->id;
                ?>
                <tr>
                    <td class="text-center" style="vertical-align: middle" >
                        <?php if (count($item->images) > 0)  ?>
                        <img src="<?= $this->baseUrl.$item->images[0] ?>" class="thumbnail" style="width: 100px;" />
                    </td>
                    <td class="text-center" style="vertical-align: middle" ><?= @$item->id ?></td>
                    <td  style="vertical-align: middle" > -- <?= @$item->name ?></td>
                    <td class="text-center" style="vertical-align: middle" ><?= @$dataCatelog[$item->categoryId] ?></td>
                    <td class="text-center" style="vertical-align: middle" for="active" ref="<?= @$item->id ?>" >
                        <?= @$item->active ? '<label class="label label-success">Hoạt động</label>' : '<label class="label label-danger">Tạm khóa</label>' ?>
                        <i style="cursor: pointer" onclick="idata.changeActive('<?= @$item->id ?>');" class="glyphicon glyphicon-<?= @$item->active ? 'check' : 'unchecked' ?> pull-right"></i>
                    </td>
                    <td class="text-center" style="vertical-align: middle" >
                        <div class="btn-group">
                            <button onclick="catelog.edit('<?= @$item->id ?>');" class="btn btn-info" type="button" >
                                <i class="glyphicon glyphicon-edit"></i> 
                                Sửa
                            </button>
                            <button onclick="image.addImage(<?= @$item->id ?>, '<?= application\entity\enu\ImageType::IMAGE ?>')" class="btn btn-warning" type="button" >
                                <i class="glyphicon glyphicon-tag"></i> 
                                Hình ảnh
                            </button>
                            <button onclick="catelog.del('<?= @$item->id ?>');" class="btn btn-danger" type="button" >
                                <i class="glyphicon glyphicon-remove"></i> 
                                Xóa
                            </button>
                        </div>
                    </td>
                </tr>
            <?php } ?>
        </tbody>
    </table>
    <p class="clearfix" ></p>
    <div style="margin-top: 10px;">
        <h5 class="pull-left alert alert-success" style="padding: 10px; width: 33%;" >
            Tìm thấy tổng số 
            <span style="color: tomato; font-weight: bolder"><?= $dataPage->dataCount ?></span> 
            bài viết trong 
            <span style="color: tomato; font-weight: bolder"><?= $dataPage->pageCount ?></span> trang.
        </h5>
        <div class="btn-toolbar pull-right" style="padding: 15px 0px;">
            <?= $this->loadView('/widget/page'); ?>
        </div>
    </div>
</div>